﻿using System.Collections.Generic;
using System.Linq;
using QDP.Platform.ObjService;
namespace QDP.Platform.Silverlight.Tools
{
    public class NavigationDirectoryHelper
    {
        /// <summary>将带有目录结构的数据服务清单转为无结构清单，返回无目录结构的数据服务自描述清单。，用于数据服务批量装载。</summary>
        /// <param name="directories">The directories.</param>
        /// <returns>返回无目录结构的数据服务自描述清单。</returns>
        /// <remarks></remarks>
        public static List<ServiceBase> RemoveDirectory(List<ServiceBase> directories)
        {
            var result = new List<ServiceBase>();
            foreach (var item in directories)
            {
                if (item is ServiceDirectory)
                    result.AddRange(RemoveDirectory((item as ServiceDirectory).SubNotes));
                else
                    result.Add(item);
            }
            return result;
        }
    }
}
